import socket

class UdpSocket:
    def __init__(self, port):
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock.bind(("0.0.0.0", port))
        self.sock.settimeout(0.01)
        
    def recv(self):
        try:
            data, addr = self.sock.recvfrom(1024 * 8)
            return data
        except socket.timeout:
            return None
        
    def send(self, ip, port, msg):
        self.sock.sendto(msg, (ip, port))
